#pragma once

#include <core/types.h>
#include <core/init.h>

#define __GBIOS_APP__   __attribute__((section(".GBiosApp"))) 


//#define MAX_PROMPT_LEN 32
//extern char g_szPrompt[];

#undef  APP_DEBUG
#define APP_HST_DEP			16 // should be 2^n bytes aligned.
#define MAX_ARGV_SIZE  		128
#define MAX_APP_ARG			64

#if APP_HST_DEP & (APP_HST_DEP - 1) != 0
#error APP_HST_DEP must power of 2!
#endif

#define APP_ADJUST_INDEX(index)	((index) & (APP_HST_DEP - 1))

typedef struct
{
	const char *pchName;
	int (*main)(int, char *[]);
	const char *pchHelpMsg;
} GApp;


#define INSTALL_APPLICATION(name, routine, helpinfo) \
	static __USED__ __GBIOS_APP__ GApp __gbios_app_##name = {#name, routine, helpinfo}

